package com.chuangsi.project.admin.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 产品表
 * </p>
 *
 * @author
 * @since 2023-03-23
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "Product对象", description = "产品表")
@TableName("t_product")
public class Product extends Model<Product> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "产品id")
    @TableId(value = "product_id", type = IdType.ASSIGN_UUID)
    @NotBlank(message = "产品id不能为空")
    @Size(max = 32, message = "产品id长度过长")
    private String productId;

    @ApiModelProperty(value = "产品名称")
    @NotBlank(message = "产品名称不能为空")
    @Size(max = 50, message = "产品名称长度过长")
    private String productName;

    @ApiModelProperty(value = "品牌id")
    @NotBlank(message = "品牌id不能为空")
    @Size(max = 32, message = "品牌id长度过长")
    private String brandId;

    @ApiModelProperty(value = "型号id")
    @NotEmpty(message = "型号id不能为空")
    @Size(max = 32, message = "型号id长度过长")
    private String modelId;

    @ApiModelProperty(value = "产品类型（1.原厂代销，2.其他代销，3.传统）")
    @NotEmpty(message = "产品类型（1.原厂代销，2.其他代销，3.传统）不能为空")
    @Size(max = 1, message = "产品类型（1.原厂代销，2.其他代销，3.传统）长度过长")
    private String type;

    @ApiModelProperty(value = "支付类型（1.全款，2.分期）")
    @NotEmpty(message = "支付类型（1.全款，2.分期）不能为空")
    @Size(max = 1, message = "支付类型（1.全款，2.分期）长度过长")
    private String payType;

    @ApiModelProperty(value = "是否E签宝合同（Y:是 N:否）")
    @NotEmpty(message="是否E签宝合同不能为空")
    @Size(max=1,message="是否E签宝合同长度过长")
    private String esignContract;

    @ApiModelProperty(value = "产品简介")
    @NotEmpty(message = "产品简介不能为空")
    @Size(max = 500, message = "产品简介长度过长")
    private String productIntroduction;

    @ApiModelProperty(value = "状态（1.启用，2.禁用）")
    @NotEmpty(message = "状态（1.启用，2.禁用）不能为空")
    @Size(max = 1, message = "状态（1.启用，2.禁用）长度过长")
    private String status;

    @ApiModelProperty(value = "产品详情")
    @NotEmpty(message = "产品详情不能为空")
    private String productDetail;

    @ApiModelProperty(value = "产品封面图片")
    @NotEmpty(message = "产品封面图片不能为空")
    @Size(max = 128, message = "产品封面图片长度过长")
    private String productImg;

    @ApiModelProperty(value = "合同模板id")
    @NotEmpty(message = "合同模板id不能为空")
    @Size(max = 32, message = "合同模板id长度过长")
    private String agreementId;

    @ApiModelProperty(value = "印章id")
    @NotEmpty(message = "印章id不能为空")
    @Size(max = 32, message = "印章id长度过长")
    private String sealId;

    @ApiModelProperty(value = "销量")
    private Integer volume;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @NotNull(message = "创建时间不能为空")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @NotNull(message = "修改时间不能为空")
    private LocalDateTime updateTime;


    @Override
    public Serializable pkVal() {
        return this.productId;
    }

}
